package com.example.aerospacemanagementsystem.controller.attendance;


import com.example.aerospacemanagementsystem.entity.attendance.Leave;

import com.example.aerospacemanagementsystem.service.attendanceService.LeaveService;
import io.swagger.annotations.Api;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

import java.util.List;

/**
 * @author 李明国
 */
@Api(tags = "请假")
@RestController
@CrossOrigin
@RequestMapping("/Leave")
public class LeaveController {
    @Autowired
    private LeaveService leaveService;
    //添加请假
    @PostMapping
    public int add(@RequestBody Leave leave){
        return leaveService.add(leave);
    }
    //删除请假
    @DeleteMapping
    public int delete(Leave leave){
        return leaveService.delete(leave);
    }
    //修改请假
    @PutMapping
    public int update(@RequestBody Leave leave){ return leaveService.update(leave);
    }
    //获取请假
    @GetMapping("/getAll")
    public List<Leave> getAllCity(Leave leave) {
        List<Leave> list = leaveService.getAllLeave(leave);
        return list;
    }
}
